package com.example.weight.navigation;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import com.example.weight.R;
import com.example.weight.householdWaste.ChangeWaterActivity;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;

public class ChangeWaterNavActivity extends AppCompatActivity {

    private String name,factory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_water_nav);

        Intent previousIntent = getIntent();
        name = previousIntent.getStringExtra("name");
        factory = previousIntent.getStringExtra("factory");

        TitleBar titleBar = findViewById(R.id.change_water_nav_titleBar);
        titleBar.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View v) {
                finish();
            }

            @Override
            public void onTitleClick(View v) {}

            @Override
            public void onRightClick(View v) {}
        });
    }

    public void go1(View view) {
        Intent intent = new Intent(ChangeWaterNavActivity.this, ChangeWaterActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("type", "1");
        startActivity(intent);
    }

    public void go2(View view) {
        Intent intent = new Intent(ChangeWaterNavActivity.this, ChangeWaterActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("type", "2");
        startActivity(intent);
    }

    public void go3(View view) {
        Intent intent = new Intent(ChangeWaterNavActivity.this, ChangeWaterActivity.class);
        intent.putExtra("name", name);
        intent.putExtra("factory", factory);
        intent.putExtra("type", "3");
        startActivity(intent);
    }

    public void turnBrowser(View view){
        Uri uri = Uri.parse("http://39.105.29.195/#/login");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
}